package codebot;

import codebot.processor.TextProcessor;

import com.google.wave.api.AbstractRobotServlet;
import com.google.wave.api.Event;
import com.google.wave.api.EventType;
import com.google.wave.api.RobotMessageBundle;

public class CodeBotServlet extends AbstractRobotServlet {

  private static final long serialVersionUID = 2666513176199262614L;

  @Override
  public void processEvents(RobotMessageBundle bundle) {

    if (bundle.wasSelfAdded()) {
      // wavelet.setTitle("title - to be replaced");
    } else {
      for (Event e : bundle.getEvents()) {
        if (e.getType() == EventType.DOCUMENT_CHANGED) {
          TextProcessor.process(new MyScreen(e.getBlip().getDocument()));
        }
      }
    }
  }
}